import Blender as B
def poly(pl):
	#TODO: mesh2vec.blender.export.poly()
		
	ob= B.Object.New("Mesh",name)
	me= B.Mesh.New(name + "_me")
	polys= list()
		
	polys.append(self)
	polys.extend([pl for pl in self.holes])
	for pl in polys:
		#vList = [v.co for v in pl]
		#me.verts.extend(vList)
		#polys.append(vList)
		vList, edgelist = pl.toMesh(offset=len(me.verts))
		me.verts.extend(vList)
		me.edges.extend(edgelist)
	#fill = B.Geometry.PolyFill(polys)
	#me.faces.extend(fill)
	if flatten:
		for v in me.verts:
			v.co.z = 0.0
	ob.link(me)
	if link:
		sce = B.Scene.getCurrent()
		sce.objects.link(ob)
	#me.triangleToQuad()
		if AT_CUR:
			cur_loc = B.Window.GetCursorPos()
			ob.setLocation(cur_loc)
	return ob

def drawing(dwg, name="Drawing" ):
	#TODO: mesh2vec.blender.export.drawing()
	objects = []
	for pl in dwg.polygons:
		objects.append(poly(link=False))
	sce = B.Scene.New(scene_name)
	for ob in objects:
		sce.objects.link(ob)
